﻿using MengLin.OOP.DesignPattern.StatePattern.WorkState.Abstract;
using MengLin.OOP.DesignPattern.StatePattern.WorkState.Implements;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.StatePattern.WorkState
{
    /// <summary>
    /// 上下文
    /// 工作上下文
    /// </summary>
    public class WorkContext
    {
        private AbstractState CurrentState;

        public WorkContext()
        {
            CurrentState = new ForenoonState();
        }

        private double _hour;
        public double Hour
        {
            get { return _hour; }
            set { _hour = value; }
        }

        private bool _finish = false;
        public bool TaskFinished
        {
            get { return _finish; }
            set { _finish = value; }
        }

        public void SetState(AbstractState state)
        {
            CurrentState = state;
        }

        public void WriteProgram()
        {
            CurrentState.WriteProgram(this);
        }
    }
}
